package com.iris.live.services.services;

import com.iris.live.services.data.models.*;
import com.iris.live.services.models.PageData;
import com.iris.live.services.models.RequestBase;
import com.iris.live.services.models.ResultData;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.sql.Date;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * Created by sxy on 2016/8/8.
 */
public interface SalesService {

	PageData getSaleList(String permit, GetSaleListRequest request);

	PageData getCarItemList(String permit, RequestBase request);

	PageData getAttachmentPolicyList(String permit, GetAttachmentPolicyListRequest request);

	// add attachmentPolicyList search
	PageData getAttachmentPolicyListByCondition(String permit, GetAttachmentPolicyListReq request);

	Lsh经销商表Model saveDealer(Lsh经销商表Model model);

	List<Lsh经销商表Model> saveDealerBatch(List<Lsh经销商表Model> modelList);

	AttachmentPolicyModel saveAttachmentPolicy(AttachmentPolicyModel model);

	List<AttachmentPolicyModel> saveAttachmentPolicyBatch(List<AttachmentPolicyModel> modelList);

	boolean saveAttachmentPolicyStatus(String siProgramCodeEnglish, String siTypeDescription, String status);

	DealerAttachmentPolicyModel saveDealerAttachmentPolicy(DealerAttachmentPolicyModel model);

	List<DealerAttachmentPolicyModel> saveDealerAttachmentPolicyBatch(List<DealerAttachmentPolicyModel> modelList);

	boolean saveDealerAttachmentPolicyStatus(String permit, Integer dealerSiNumber, String status);

	Itask基础设置Model saveBasicSetting(Itask基础设置Model model);

	List<Itask基础设置Model> saveBasicSettingBatch(List<Itask基础设置Model> modelList);

	Lsh随车项目设置Model saveCarItemSetting(Lsh随车项目设置Model model);

	List<Lsh随车项目设置Model> saveCarItemSettingBatch(List<Lsh随车项目设置Model> modelList);

	public PageData getActiveCarItemSettingList(String permit, GetCarItemSettingRequest request);

	boolean saveSalesAdminModelBatch(List<Lsh销售行政Model> modelList);

	public PageData getDealerInfo(String dealer, Map map, RequestBase request);

	public void exportStockInfo(String dealer, Map map, RequestBase request, OutputStream response);

	public PageData getOtherDealerInfo(String dealer, Map map, RequestBase request);

	public PageData getOtherStoreCar(GetOtherStoreCarReq request);

	public List SelectCarTransferLog(String VIN, String type);

//	boolean updateCustInfoByVIN(UpdateCustInfoByVINReq req);

	public List getNoReceiptProNo(String permit);

	public List getCompareModelsList();

	ResultData saveLshStock(List<SaveLshStockReq> reqList, String operaAcct, String permit);

//	boolean updateByStockNo(UpdateByStockNoReq request);

	public Map getTransferCustInfo(Integer stock_code);

//	public boolean addTransferCustInfo(CarTransferLogModel model);

//	public boolean updateByStockCode(UpdateByStockCodeReq req);

	public List selectExistNum(List<Lsh库存表Model> modelList);

	public int addLshStockTable(List<Lsh库存表Model> modelList);

	public boolean updateNbiCarStatus(String permit) throws ParseException;

    public List getCarTransferCustInfo(String dlr, String transId);

//	public boolean updateOuterStatus(UpdateOuterStatusReq request);

    ResultData updateOuterStatusRuku(String dealer, String username, UpdateOuterStatusReq req);

//	public CarTransferLogModel saveByStockCode(CarTransferLogModel model);

	public List getInnerDetails(String productNo);

	public List selectExpectGiveCarDateAndReason(String vin);

	public List getInnerData(String param, String type);

	List getOuterVisableLevel(String productNo);

	List getInnerVisableRole(String productNo);

	List getSelfCarStatusList(String permit);

	boolean updateOuterVisableLevel(SalesService.UpOuterVisableLevelRequest upVisableReq);

	List getKCNumByProductNum(String productNo);

	boolean delInternalVisibleLevel(DelInternalVisibleLevelRequest request);

	boolean saveInternalVisibleLevel(SaveInternalVisibleLevelRequest saveRequest,String username);

	List followCluesList(String permit, String date);

    List getWeekReprot(String years, String permit);

    List getRoleAndpermitAndname(SaveInternalVisibleLevelRequest reli);

	ResultData isShunt(IsShuntReq req, String permit);
//    ResultData isShunt(IsShuntReq req);

    ResultData saveCarStates(List<IsShuntReq> req);

    ResultData findDealerInfoById(String quoteId);

    ResultData getTransferCarList(String permit);

	ResultData getCompanyAndCTA(SalesService.GetSaleListRequests re, String p, String s);

	ResultData saveDealerInfoItem(List<saveDealerInfoItem> model, String permit, String username);

	ResultData getDealerBatchInfo(SalesService.GetSaleListRequests re, String p, String s);

	ResultData getExchangeList(ExchangeInfo requestBase, String permit);

	ResultData getChangeCarList(ChangeCarInfo info, String permit);

	ResultData administrativeChangeCar(ChangeCar info, String userName, String permit);


	Map getCodeByRole(ChangeCar info, String userName, String permit);

	Map getCtaCodeByRole(ChangeCar info, String userName, String permit);

	Map getBMBsCodeByRole(ChangeCar info, String userName, String permit);

	Map getBMBsCodeByBigAreaRole(ChangeCar info, String userName, String permit);

	Map getBMBsCodeByCTA(ChangeCar info, String userName, String permit);

	Map getTOTALCodeByTOTAL(ChangeCar info, String userName, String permit);

	ResultData saveNewCesar(List<SaveNewCesar> reqList, String operaAcct, String permit );

	ResultData getDeleteNewCesarList (  RequestBase request,   String userName, String permit);

	ResultData deleteNewCesarList(   List<Integer> stockIdList,   String userName, String permit);

	ResultData getUserInfo(   String userName, String permit);

	Map getCustomerLeaveState( String userName, String permit,Integer custenterid);

	ResultData saveNewDMS(List<SaveNewDms> reqList, String operaAcct, String permit );

	ResultData saveCesarAndDmsExcel( String operaAcct, String permit, MultipartFile file,String name);

	Map saveLeaveTime(String userName, String permit,SaveLeaveTime  laveTimeInfo );

	ResultData getgetInfrastructure(List<Itask基础设置Model> modelList);

    Object fillContractExcel(String fileName, String prodNum, String dlr);

	ResultData getSaleTailAfter(String permit,SaleTailAfter request, RequestBase RBase);

	public void ExportSaleTailAfter(String dealer, Map map, RequestBase request, OutputStream outputStream);

	PageData getInventoryInfo(String dealer, Map map, RequestBase request);

	public void exportInventoryInfo(String dealer, Map map, RequestBase request, OutputStream response);

	ResultData getOrders(String dlr, GetOrdersRequest req);

	ResultData getOrdersHistory(String originId);

	ResultData getOrdersReview(Integer qNum);

	void exportOrder(String dealer, Map map, RequestBase request, OutputStream response);

	void calculateGp(List list);

	ResultData boutiqueContract(String dealer,Map map,HttpServletResponse response);

	PageData getInfoByProudctionId(String pid, HttpServletRequest request);
	static class GetSaleListRequest extends RequestBase {
		public String area1;
		public String area2;
		public String province;
		public String city;
		public String sale;
		public String licence;
	}

	static class GetSaleListRequests extends RequestBase {
		public String area1; //大区
		public String area2;// 小区
		public String province;// 省份
		public String city;// 城市
		public String dealerlogo;//经销商代码---许可bmbs
		public String dealername;//经销商名称


	}

	static class GetAttachmentPolicyListRequest extends RequestBase {
		public String siCode;
		public String siName;
		public Date releaseDate;
		public int financeProductNumber;
		public Date startDate;
		public Date endDate;
		public String siStatus;
	}

	// add attachmentPolicyList search
	static class GetAttachmentPolicyListReq extends RequestBase {
		public String siCode;
		public String siName;
		public String siStatus;
		public String siType;
		public String carInfo;
		public int siFinance1;
		public int siFinance2;
	}

	static class DelInternalVisibleLevelRequest extends RequestBase {
		public String 内部可见角色;
		public Integer 库存编号;
	}

	static class GetCarItemSettingRequest extends RequestBase {
		public Integer car;
		public String permit;
	}

	class GetOtherStoreCarReq extends RequestBase{
		public String area1;
		public String area2;
		public String dealer;
		public String CTA;
	}

//	class UpdateCustInfoByVINReq{
//		public String VIN;
//		public String guest;
//		public String reason;
//		public Integer amount;
//		public String ownerOrDrawerName;
//		public Date expectedLateInStockDate;
//		public Date expectedLateMoneyInAccount;
//	}

	class SaveLshStockReq{
		public String productNo;  //生产号
		public Integer carNo;  //车型编号
		public Date proDate;  //生产日期
		public String VIN;  //车架号
		public String chassisNo;  //欧版底盘号
		public String engineNo;  //发动机号
		public String VSB;  //VSB号
		public String colorCode;  //颜色代码
		public String color;  //颜色
		public String innerCode;  //内饰代码
		public String inner;  //内饰
		public String factoryConfig;  //原厂配置
		public String addConfig;  //加配配置
		public BigDecimal addConfigPrice;  //加配价格含税
		public BigDecimal buyPriceTax;  //采购价格含税
		public BigDecimal buyPrice;  //采购价格未税
		public BigDecimal factMSRPTax;  //实际MSRP含税
		public Date orderDate;  //厂家确认订单日期
		public BigDecimal standardMSRPTax;  //标配MSRP含税
		public Date expectRollDate;  //预计下线日期
		public String wholesaler;  //批发商
		public String status;  //物流状态
		public Date startProduDate;  //开始生产日期
	}

	class SaveNewDms{
		public String productNo;  //生产号
		public String colorCode;  //颜色代码
		public String color;  //颜色
		public String innerCode;  //内饰代码
		public String inner;  //内饰
		public String chassisNo;  //欧版底盘号
		public String VSB;  //VSB号
		public String factoryConfig;  //原厂配置
		public String addConfig;  //加配配置
		public BigDecimal addConfigPrice;  //加配价格含税
		public BigDecimal buyPriceTax;  //采购价格含税
		public BigDecimal buyPrice;  //采购价格未税
		//public BigDecimal BIPrice;  //BI车款标配MSRP含税
		public BigDecimal standardMSRPTax;  //标配MSRP含税
		public BigDecimal factMSRPTax;  //实际MSRP含税
		public String VBSState;//vbs财务状态
		public Date expectRollDate;  //预计下线日期
		//public Date orderDate;  //厂家确认订单日期
		public String wholesaler;  //批发商
		public  String variant;//Variant
		//public String BuildData;
		public Date startProduDate;  //开始生产日期
		public String status;  //物流状态
	}
	class SaveNewCesar{
		public String productNo;  //生产号
		public Integer carNo;  //车型编号
		public Date proDate;  //生产日期
		public String VIN;  //车架号
		public String engineNo;  //发动机号
		public String colorCode;  //颜色代码
		public String color;  //颜色
		public String innerCode;  //内饰代码
		public String inner;  //内饰
		public Date orderDate;  //厂家确认订单日期
		public Date aimPortDate;//预计到港日期
		public Date realPortDate;//实际到港日期
		public String portId;//港口代码
		public String primaryStatus;// 值为LFON则不导入
		public Date holdDate;//Hold日期
		public Date  wholesaleDate;//批发日期
		public String status;  //物流状态
		public  String portName;//港口名称
		public BigDecimal BIPrice;//未导入DMS的MSRP

	}

//	class UpdateByStockNoReq{
//		public Integer stockNo;
//		public String guest;
//		public String reason;
//		public Integer amount;
//	}

//	class UpdateByStockCodeReq{
//		public Integer stock_code;
//		public Date stock_out_date;
//		public String stock_out_user;
//	}

	class UpdateOuterStatusReq{
        public String productNo; // 库存编号
        public String guest; // 申请销售顾问
        public String reason; // 调车理由
        public BigDecimal amount; // 协商调车款项金额
        public String innerDealer; // 调入经销商
        public String outerDealer; // 调出经销商
        public String outerStatus; // 调车物流状态
    }

	static class saveDealerInfoItem {
		public String bmbs;
		public String lsh;
		public String 经销商名;
		public String 经销商名en;
		public String 经销商;
		public String 经销商en;
		public String 省份;//7


		public String 省份en;
		public String 城市;
		public String 城市en;//10

		public String 大区;
		public String 大区en;
		public String 小区;
		public String 小区en;
		public String cta;//15

		public String ctaEn;
		public String 经销商全称;//17
		public String 经销商全称en;
		public String 经销商地址;
		public String 经销商地址en;//20


		public String 经销商电话;
		public String 经销商状态;
		public String 经销商类型;
		public String 经销商功能;
		public String 功能类型;//25


		public String 销售能力;
		public String 开业日期;
		public String 生效日期;
		public String ncCode;
		public String dmsCode;//30
		public String salesCode;
		public String dealerCode;
		public String imsCode;
		public String 是否测试;
		public String 更新账号;
		public String 更新时间;//36

		public String projectCode;
	}


	class UpOuterVisableLevelRequest extends RequestBase{
		public String productNo;
		public String visableLevel;
	}

	class SaveInternalVisibleLevelRequest extends RequestBase{
		public String productNo;
		public String visableLevel;
    }

    static class IsShuntReq {
        public String vin;
		public String otherShopPermit;
	}

	class ExchangeInfo extends RequestBase{
	    public String customerName;//顾客姓名
        public String scName;//销售顾问名
        public String  carType;//车款
        public String minSignDate;//订单签署日期开始
        public String bigSignDate;//订单签署日期结束
         }
	class ChangeCarInfo extends RequestBase {
		public String source;//来源
		public String brand;//品牌
		public String series;//级别
		public String carType;//车型
		public String carParticulars;//车型详细
		public String msrp;//MSRP
		public String vin; // 车架号
	}

	class ChangeCar {
		public Integer quoId;//报价编号
		public Integer stockNumber;//新车库存编号
		public String telNumber;//顾客电话
		public String cusName;//客户名
		public String salesName;//销售顾问名
		public String salesTel;//销售顾问电话
		public String salesCode;//销售顾问账号

		public String actualValue;
		public String actualValueCode;
	}
	class SaveLeaveTime{
		public   Integer custenterid;//进店编号
		public  String leaveTime;//离店时间
	}

	class SaleTailAfter extends RequestBase{
		public String VIN;  //车架号
		public String productNo;  //生产号
		public String ShuntingType; //调车类型
		public String outerStatus; // 调车物流状态
		public String custName;//客户姓名
		public String guest; // 申请销售顾问
		public String innerDealer; // 调入经销商
		public String outerDealer; // 调出经销商


	}

	class GetOrdersRequest extends RequestBase {
		public Boolean orderedUnsold; // 已订单未零售
		public String cus; // 订单客户
		public String custPhone;  //客户电话
		public String sc; // 销售顾问
		public String prodNum; // 生产号
		public Date orderDtStart; // 订单签署日期开始
		public Date orderDtEnd; // 订单签署日期结束
		public String vin; // 车架号
		public Date exOrderDtStart; // 意向签署日期开始
		public Date exOrderDtEnd; // 意向签署日期结束
		public String status; // 新车销售状态
		public Date invoiceDtStart; // 开票日期开始
		public Date invoiceDtEnd; // 开票日期结束
		public Date deliverDtStart; // 交车日期开始
		public Date deliverDtEnd; // 交车日期结束
		public String brand; // 品牌
		public String clazz; // 车系
		public String model; // 车型
		public String modelDetail; //车款
	}
}
